package com.uco.file;

import java.io.File;

public class FileTest {
    public static void main(String[] args) {
        File f1 = new File("/Users/xuwenjie/Desktop/create_table.sql");
        if(! f1.exists()) { System.out.println("文件不存在"); }
        System.out.println(f1.isFile());
        System.out.println(f1.isDirectory());
        System.out.println(f1.length());
        System.out.println(f1.getAbsolutePath());
        System.out.println(f1.getParent());
        System.out.println(f1.getName());
        System.out.println(f1.canRead());
        System.out.println(f1.canWrite());

//        File dirs = new File("/Users/xuwenjie/Desktop/test");
//        if(! dirs.exists()) {
//            dirs.mkdirs();
//        } else {
//            dirs.delete();
//        }

        File dirs = new File("/Users/xuwenjie/Desktop/scripts");
        File[] files = dirs.listFiles();
        for (File file : files) {
            System.out.println(file.getAbsoluteFile());
        }
    }
}
